﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CoVanHocTapData.Interface;
using CoVanHocTapData.Entities;

namespace CoVanHocTapData.Concretes
{
    public class KhoaRepository:IKhoaRepository
    {
        static DangKyPhuEntities entities = new DangKyPhuEntities();

        public KhoaRepository()
        {
            //entities = new DangKyPhuEntities();

        }

        public static Khoa LayKhoaTheoNganh(string nganhID)
        {
            return (from m in entities.Khoas
                        join n in entities.NganhDaoTaos
                        on m.KhoaID equals n.KhoaID
                        where n.NganhID.Equals(nganhID)
                        select m).FirstOrDefault();
        }

        public IQueryable<Khoa> LayTatCaKhoa()
        {
            return from m in entities.Khoas
                   select m;
        }
        
    }
}
